from sys import argv

from bin.help.help import help_message
from bin.run.run import runserver, makemigrations, migrate, buildDocker, installModel, importDatabase

COMMAND = {
    "runserver": runserver,  # 启动服务
    "makemigrations": makemigrations,  # 生成数据库
    "buildDocker": buildDocker,  # 生成Docker镜像
    "install": installModel,  # 安装模块
    "importDatabase": importDatabase,  # 导入数据库: 将已经存在的数据库导入到项目中
}


def main():
    print("python", " ".join(argv))
    if len(argv) < 2:
        help_message()
        return
    COMMAND.get(argv[1], help_message)()


if __name__ == "__main__":
    main()
